The annotation you're looking for is org.hibernate.annotations. Cache Basic usage is.
The annotation you're looking for is org.hibernate.annotations.Cache. Basic usage is: @Entity @Cache(usage=CacheConcurrencyStrategy. NONSTRICT_READ_WRITE) public MyEntity { ... @Cache(usage = CacheConcurrencyStrategy.
NONSTRICT_READ_WRITE) public List getSomeCollection() { ... } } For queries, you need to enable query cache by setting hibernate.cache. Use_query_cache property to true AND specify that query is cacheable in its declaration (for named queries) or by calling setCacheable(true) on query instance. All that said, you need to be really careful with caching and REALLY UNDERSTAND what you're doing, otherwise it'll do more harm than help.
Don't look at it as "quick fix" - caching everything, for example, is definitely the wrong thing to do.
2- there is no dif in annotation syntax that what second_level_cache implementation I use?(i use net.sf.ehcache.hibernate. EhCacheProvider) – Am1rr3zA Aug 2 '09 at 6:41 1 1) You most certainly should not make all your entities cacheable. Best candidates for caching are entities that are read often but don't change often and you don't have too many of them.
Enable see what "SELECT * FROM my_entity_table WHERE ID=?" queries run most often, those MAY be candidates for entity caching. 2) Implementations are configured via properties (like you've done). Annotations are the same no matter what implementation you use; however some implementations may not support some cache strategies.
Link I posted in my answer lists all implementation features. – ChssPly76 Aug 2 '09 at 16:56.
Your settings will make the second-level and query caches available for use in your project, but you still need to enable it for specific entities, collections, and queries. This requires some careful planning because there are trade-offs that you'll need to understand. In general, the second-level and query caches are appropriate for read-only or read-mostly data, but not volatile data.
If you don't already own it, I would recommend picking up a copy of Java Persistence with It has a very good treatment of the subject.
Tanx for answer but need more quick information :| – Am1rr3zA Aug 1 '09 at 14:21.
I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.